#ifndef NP_DAOATTACH_H
#define NP_DAOATTACH_H
#include <config/Structures.h>
#include <mysql/mysql.h>
#include "Daobase.h"
class DaoAttach: public Daobase
{
public:
  DaoAttach();

  DaoAttach(const MYSQL* conn) : Daobase(conn) {}

  void addAttach(const attachInfo::AttachInfo& attach);

  void updateAttachInvalid(const std::string& articleid);

  int getAttachList(const chapterInfo::ChapterInfo& chapter,  attachInfo::AttachInfo* attachList);

  void getAttachMaxID(std::string &buffer);
private:
  void fillAttach(const MYSQL_ROW& row, attachInfo::AttachInfo& attach);
  int traverseResult(const MYSQL_RES *res, attachInfo::AttachInfo* attachList);
};

#endif // NP_DAOATTACH_H
